<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>55社区</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="/theme/default/images/favicon.png">
    <link href="${ctx}/static/phone/css/amazeui.min.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/static/phone/css/style.css" rel="stylesheet" type="text/css" />
    <script src="${ctx}/static/phone/js/jquery-1.10.2.min.js"></script>
    <script src="${ctx}/static/phone/js/time.js"></script>
</head>
<body>
<header data-am-widget="header" class="am-header am-header-default sq-head ">
    <div class="am-header-left am-header-nav">
        <a href="javascript:history.back()" class="">
            <i class="am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="" class="">确认订单</a>
    </h1>
</header>
<div style="height: 49px;"></div>
<div class="add-address">
    <a href="${ctx}/phone/address.jsp">+新建收货地址</a>
    <i class="am-icon-angle-right"></i>
</div>
<div style="background: #eee; height: 10px;"></div>
<ul class="shopcart-list" style="padding-bottom: 0;">
    <c:forEach var="shopcar" items="${shopcartList}">
        <li>
            <img src="${ctx}/static/phone/${shopcar.goods_img}" class="shop-pic" />
            <div class="order-mid">
                <input class="car_id" value="${shopcar.shopcart_id}" type="hidden">
                <div class="tit">${shopcar.goods_name}</div>
                <div id="" class="order-price price">${shopcar.goods_price} <i>X<i id="text_box">${shopcar.goods_num}</i></i></div>
            </div>
        </li>
    </c:forEach>
</ul>
<ul class="order-infor">
    <li class="order-infor-first">
        商品总计：<span></span>
        <i class="total"></i>
    </li>
    <li class="order-infor-first">
        <span >运费：</span>
        <i>包邮</i>
    </li>
    <li class="order-infor-first">
        <a href="">积分抵费></a>
    </li>
    <li class="order-infor-first">
        <a href="">选择优惠券></a>
    </li>
</ul>
<div style="background: #eee; height: 10px;"></div>
<textarea placeholder="备注说明" class="bz-infor"></textarea>
<div style="background: #eee; height: 10px;"></div>
<div style="height: 55px;"></div>
<div class="shop-fix">
    <div class="order-text">
        应付总额：<i class="total"></i>
    </div>
    <a  href="javascript:void(0)" class="js-btn">提交订单</a>
</div>
<!--底部-->
<jsp:include page="commonBottom.jsp"></jsp:include>

<script>
    $(function () {
        $(".js-btn").click(function () {
            var Checkbox=false;
            var ids=new Array();//声明一个数组
            $(".car_id").each(function () {
                Checkbox=true;
                var id=$(this).val();//取出值
                console.info(id)
                ids.push(id);//加入数组
            });
            if (Checkbox){
                var t=confirm("您确认要提交订单吗？");
                if (t==false) {
                    return false;
                }else{
                    window.location.href="${ctx}/category/submitorder.do?ids="+ids;
                }
            }
        });
    });
    function money() {
        var money = 0;
        $(".shopcart-list li").each(function (index) {
            var price = parseFloat($(this).find('.price').html()); //获取商品单价
            console.info(price)
            var num = parseFloat($(this).find('#text_box').text()); //获取商品数量
            console.info(num)
            money += price * num;
            console.info(money)
        })
        $(".total").text(money);
    }

    $().ready(function(){
        money()
    })
</script>

<script src="${ctx}/static/phone/js/jquery.min.js"></script>
<script src="${ctx}/static/phone/js/amazeui.min.js"></script>
</body>
</html>
